package com.joyintech.enums;

/**
 * 基金的风险等级是反者来的   1~5 由低到高
 */
public enum FundRiskLevelEnum {
    R1("1","低风险级别（1级"),
    R2("2","较低风险级别（2级）"),
    R3("3","中等风险级别（3级）"),
    R4("4","较高风险级别（4级）"),
    R5("5","极高风险级别（5级）"),
    ;

    private String code;
    private String name;

    FundRiskLevelEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static FundRiskLevelEnum getNameByCode(String code) {
        for (FundRiskLevelEnum codeEnum : FundRiskLevelEnum.values()) {
            if (codeEnum.getCode().equals(code)) {
                return codeEnum;
            }
        }
        return null;
    }
}
